﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%

    var statics = ViewData["Statisc"] as StatisticEntity;
    var maxOnline = ViewData["TimeMaxUsersOnline"] as Statistic;
    
%>
<div class="fr-widget white-space">
    <div class="header">
        <div class="collapse {collapseId:'#collapse-panel-statis'} collapse-close">
        </div>
        <div class="icon">
        </div>
        <span class="header-txt">
            <%=ForumContext.GetText("STATIS", "STATIS_HEADER")%>
        </span>
    </div>
    <div id="collapse-panel-statis">
        <table cellpadding="0" cellspacing="1" width="100%">
            <tr>
                <td class="table-caption">
                    <%=string.Format(ForumContext.GetText("STATIS", "USERS_ONLINE"), statics.TotalUsersOnline, statics.TotalUsersOnline - statics.Guests, statics.Guests)%>
                </td>
            </tr>
            <tr>
                <td class="table-cell statis-panel statis-user-online valign-top">
                    <%=string.Format(ForumContext.GetText("STATIS", "MAX_USERS_ONLINE"), maxOnline.TotalUsersOnline, ForumContext.PrettyDate(maxOnline.Created))%><br />

                    <%
    var _usersOnline = ViewData["UsersOnline"] as List<UserOnline>;
    int _i = 0;
    if (_usersOnline != null)
        foreach (var _online in _usersOnline)
        {
            if (_i > 0)
                Response.Write(", ");
            Response.Write(string.Format("<a href=\"{0}\" title=\"{1}\" class=\"{2}\">{1}</a>", ForumContext.GetAbsoluteUrl(ForumUrls.USER_INFO, _online.UserName), _online.UserName,_online.CssClass));
            _i++;
        }

%>
                </td>
            </tr>
            <tr>
                <td class="table-caption">
                    <%=ForumContext.GetText("STATIS", "FORUM_STATIS")%>
                </td>
            </tr>
            <tr>
                <td class="table-cell statis-panel statis-forum valign-top">
                    <%=string.Format(ForumContext.GetText("STATIS", "TOTAL_STATIS"), statics.TotalUsers, statics.TotalTopics, statics.TotalPosts)%><br />
                    <%=string.Format(ForumContext.GetText("STATIS", "NEW_IN_PAST_24HOURS"), statics.NewTopicsInPast24Hours, statics.NewPostsInPast24Hours, statics.NewUsersInPast24Hours)%><br />
                    <%if (statics.NewestUserID != null)

                          Response.Write(string.Format(ForumContext.GetText("STATIS", "NEWEST_MEMBER"), ForumContext.GetAbsoluteUrl(ForumUrls.USER_INFO, statics.NewestUserID), statics.NewestUserID));
                    %>
                    <br />
                </td>
            </tr>
        </table>
    </div>
</div>
